<?php 

namespace app\admin\controller;
use app\admin\server\Products as productsServer;
use app\admin\model\Products as productsModel;


class Products extends Base
{
	/**
	 * 商品列表
	 */
	public function productsLists()
	{
		if(request()->isAjax()){
			//获取列表
	
			$result = (new productsServer())->getProductsByWhere();
			//总数量 
            $return['total'] = $result[1];  // 总数据
            $return['rows'] = $result[0];
            return json($return);
		}
		return $this->fetch();
		
	}

	/**
	 * 添加
	 */
	public function add()
	{
		if(request()->isAjax()){

		}else{
			return $this->fetch();
		}
	}




	/**
	 * 加入回收站
	 */
	public function del()
	{
		//假删除
        $flag = (new productsServer())->delProduct();
        return json(msg($flag['code'], $flag['data'], $flag['msg']));
	}






	  /**
     * 上下架
     * @return [type] [description]
     */
    public function is_show()
    {
        //修改状态
        $flag = (new productsServer())->saveStatusByID();
        return json(msg($flag['code'], $flag['data'], $flag['msg']));
    }






}